{{csrf_field()}}
<style>
    /*上传图片用到css*/
    .layui-upload-img {
        width: 92px;
        height: 92px;
        margin: 0 10px 10px 0;
    }

    .upload-img-show {
        position: relative;
    }

    .file_close {
        height: 20px;
        width: 20px;
        background: #a7a7a7;
        position: absolute;
        right: 5px;
        border-radius: 25px;
        text-align: center;
        color: #FFFFFF;
        cursor: pointer;
    }
</style>
<div class="layui-form-item">
    <label for="" class="layui-form-label">店铺分类</label>
    <div class="layui-input-inline">
        <select name="category_id" lay-verify="required">
            <option value=""></option>
            @foreach($categorys as $category)
                <option value="{{ $category->id }}" @if(isset($store->category_id)&&$store->category_id==$category->id)selected @endif >{{ $category->name }}</option>
            @endforeach
        </select>
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">店铺名称</label>
    <div class="layui-input-inline">
        <input type="text" name="name" value="{{ $store->name ?? old('name') }}" lay-verify="required" placeholder="店铺名称" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">联系人手机号</label>
    <div class="layui-input-inline">
        <input type="text" name="phone" value="{{$store->phone??old('phone')}}" required="phone" lay-verify="phone" placeholder="联系人手机号" class="layui-input">
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">地址</label>
    <div class="layui-input-inline">
        <input type="text" name="area" value="{{$store->area??old('area')}}" placeholder="地址" class="layui-input">
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">经度</label>
    <div class="layui-input-inline">
        <input type="text" name="longitude" value="{{$store->longitude??old('longitude')}}" placeholder="经度" class="layui-input">
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">纬度</label>
    <div class="layui-input-inline">
        <input type="text" name="latitude" value="{{$store->latitude??old('latitude')}}" placeholder="纬度" class="layui-input">
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">省名称</label>
    <div class="layui-input-inline">
        <input type="text" name="province_name" value="{{ $store->province_name ?? old('province_name') }}" lay-verify="required" placeholder="省名称" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">省代码</label>
    <div class="layui-input-inline">
        <input type="text" name="province_code" value="{{ $store->province_code ?? old('province_code') }}" lay-verify="required" placeholder="省代码" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">市名称</label>
    <div class="layui-input-inline">
        <input type="text" name="city_name" value="{{ $store->city_name ?? old('city_name') }}" lay-verify="required" placeholder="市名称" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">市代码</label>
    <div class="layui-input-inline">
        <input type="text" name="city_code" value="{{ $store->city_code ?? old('city_code') }}" lay-verify="required" placeholder="市代码" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-form-label">上传logo</div>
    <div class="layui-card-body">
        <div class="layui-upload">
            <button type="button" class="layui-btn" id="test-upload-logo">图片上传</button>
            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                预览图：
                <div class="layui-upload-list" id="test-upload-logo-list" style="display: flex;">
                    @if(!empty($store->logo))
                        <div class="upload-img-show">
                            <div class="file_close">X</div>
                            <img src="{{ $store->logo ?? old('logo') }}" class="layui-upload-img">
                        </div>
                    @endif

                    @if(!empty($store->logo))
                            <input type="hidden" name="logo" value="{{ $store->logo ?? old('logo') }}">
                    @endif
                </div>
            </blockquote>
        </div>
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-form-label">上传背景图片</div>
    <div class="layui-card-body">
        <div class="layui-upload">
            <button type="button" class="layui-btn" id="test-upload-more">多图片上传</button>
            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                预览图：
                <div class="layui-upload-list" id="test-upload-more-list" style="display: flex;">
                    @if(!empty($store->background))
                    @foreach($store->background as $value)
                            @if(!empty($value))
                            <div class="upload-img-show">
                                <div class="file_close">X</div>
                                <img src="{{ $value ?? old('background') }}" class="layui-upload-img">
                            </div>
                            @endif
                    @endforeach
                    @endif

                    @if(!empty($store->background))
                    @foreach($store->background as $value)
                                @if(!empty($value))
                                <input type="hidden" name="background[]" value="{{ $value ?? old('background') }}">
                                @endif
                    @endforeach
                    @endif
                </div>
            </blockquote>
        </div>
    </div>
</div>

<div class="layui-form-item">
    <div class="layui-inline">
        <label class="layui-form-label">营业时间</label>
        <div class="layui-input-inline">
            @if(isset($store->open_time))
                <input type="text" name="open_time" value="{{$store->open_time}}" class="layui-input data-time" placeholder=" - ">
            @else
                <input type="text" name="open_time" class="layui-input data-time" placeholder=" - ">
            @endif
        </div>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">是否关闭店铺</label>
    <div class="layui-input-block">
        @if(isset($store->is_close) && $store->is_close == 1)
        <input type="checkbox" checked name="is_close" lay-skin="switch">
        @else
        <input type="checkbox" name="is_close" lay-skin="switch">
        @endif
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">是否显示店铺</label>
    <div class="layui-input-block">
        @if(isset($store->is_show) && $store->is_show == 1)
            <input type="checkbox" checked name="is_show" lay-skin="switch">
        @else
            <input type="checkbox" name="is_show" lay-skin="switch">
        @endif
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">价格</label>
    <div class="layui-input-inline">
        <input type="text" name="price" value="{{ $store->price ?? old('price') }}" lay-verify="required" placeholder="价格" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">折扣</label>
    <div class="layui-input-inline">
        <input type="text" name="discount" value="{{ $store->discount ?? old('discount') }}" lay-verify="required" placeholder="折扣" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label for="" class="layui-form-label">进入奖金池比例</label>
    <div class="layui-input-inline">
        <input type="text" name="bonus_pool_proportion" value="{{ $store->bonus_pool_proportion ?? old('bonus_pool_proportion') ?? 0.2  }}" lay-verify="required" placeholder="折扣" class="layui-input" >
    </div>
</div>
<div class="layui-form-item">
    <label for="" class="layui-form-label">提现手续费</label>
    <div class="layui-input-inline">
        <input type="text" name="cash_proportion" value="{{ $store->cash_proportion ?? old('cash_proportion') ?? 0.1 }}" lay-verify="required" placeholder="折扣" class="layui-input" >
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">文章内容</label>
    <textarea lay-verify="article_desc" id="demo" style="display: none;" name="message">{{ $store->message ?? old('message') }}</textarea>
</div>

<div class="layui-form-item">
    <div class="layui-input-block">
        <button type="submit" class="layui-btn" lay-submit="" lay-filter="component-form-demo1">确 认</button>
        <a  class="layui-btn" href="{{route('admin.store')}}" >返 回</a>
    </div>
</div>